load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")
load("@fbsource//tools/build_defs:rust_linkable_symbol.bzl", "rust_linkable_symbol")

oncall("build_infra")

rust_library(
    name = "buck2_cmd_completion_client",
    srcs = glob(["src/**/*.rs"]),
    test_deps = ["fbsource//third-party/rust:paste"],
    deps = [
        "fbsource//third-party/rust:async-trait",
        "fbsource//third-party/rust:clap",
        "fbsource//third-party/rust:clap_complete",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:tokio",
        ":completion_wrapper_bash",
        ":completion_wrapper_fish",
        ":completion_wrapper_zsh",
        ":options_wrapper_bash",
        ":options_wrapper_fish",
        ":options_wrapper_zsh",
        "//buck2/app/buck2_cli_proto:buck2_cli_proto",
        "//buck2/app/buck2_client_ctx:buck2_client_ctx",
        "//buck2/app/buck2_common:buck2_common",
        "//buck2/app/buck2_core:buck2_core",
        "//buck2/app/buck2_error:buck2_error",
        "//buck2/app/buck2_fs:buck2_fs",
    ],
)

rust_linkable_symbol(
    name = "completion_wrapper_bash",
    content_str = "src/completion/completion-wrapper.bash",
)

rust_linkable_symbol(
    name = "completion_wrapper_fish",
    content_str = "src/completion/completion-wrapper.fish",
)

rust_linkable_symbol(
    name = "completion_wrapper_zsh",
    content_str = "src/completion/completion-wrapper.zsh",
)

rust_linkable_symbol(
    name = "options_wrapper_bash",
    content_str = "src/completion/options-wrapper.bash",
)

rust_linkable_symbol(
    name = "options_wrapper_fish",
    content_str = "src/completion/options-wrapper.fish",
)

rust_linkable_symbol(
    name = "options_wrapper_zsh",
    content_str = "src/completion/options-wrapper.zsh",
)
